Skip to content

fix(ui): exclude display name from required-field validation in tool form#3464

Merged
crivetimihai merged 2 commits intomainfrom
bug/ui-tool-creation-requires-display-name
Mar 10, 2026
Merged

fix(ui): exclude display name from required-field validation in tool form#3464
crivetimihai merged 2 commits intomainfrom
bug/ui-tool-creation-requires-display-name

Conversation

@Nayana-R-Gowda
Copy link
Copy Markdown
Collaborator

@Nayana-R-Gowda Nayana-R-Gowda commented Mar 4, 2026

Signed-off-by: NAYANA.R nayana.r7813@gmail.com
closes #3433

💡 Fix Description

ixed validation selector in admin.js so displayName is no longer treated like the required technical name field.

🧪 Verification

Check Command Status
Lint suite make lint pass
Unit tests make test pass

📐 MCP Compliance (if relevant)

  • Matches current MCP spec
  • No breaking change to MCP clients

✅ Checklist

  • Code formatted (make black isort pre-commit)
  • No secrets/credentials committed

Copy link
Copy Markdown
Collaborator

@msureshkumar88 msureshkumar88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary for PR #3464

Issue: #3433 - Unable to create a tool without a display name

Changes: Modified admin.js:16625-16627 to fix form validation selector

✅ Fix Validation

The PR correctly addresses the reported bug:

  • Root Cause: The wildcard selector input[name*="name"] was matching ALL fields containing "name", including the optional displayName field
  • Solution: Changed to exact attribute matching: input[name="name"], input[name="customName"], input[name="custom_name"]
  • Result: Optional displayName fields are no longer incorrectly validated as required

📊 Review Findings

1 issues identified:

  1. Medium Severity: Missing test coverage for the validation exclusion fix

✅ Strengths

  • Minimal, surgical fix that directly addresses the bug
  • Preserves validation for actual required name fields
  • Handles multiple naming conventions (name, customName, custom_name)
  • Clear inline comment explaining the change

🔍 Key Recommendations

  1. Add automated tests to prevent regression (most important)

@crivetimihai crivetimihai changed the title This prevents the admin UI from blocking tool creation when the optional Display Name is left empty fix(ui): exclude display name from required-field validation in tool form Mar 5, 2026
@crivetimihai crivetimihai added bug Something isn't working ui User Interface SHOULD P2: Important but not vital; high-value items that are not crucial for the immediate release labels Mar 5, 2026
@crivetimihai crivetimihai added this to the Release 1.0.0-RC2 milestone Mar 5, 2026
@crivetimihai
Copy link
Copy Markdown
Member

Thanks @Nayana-R-Gowda — correct fix for #3433. Narrowing the querySelector to only target technical name fields is the right approach. LGTM.

@Nayana-R-Gowda
Copy link
Copy Markdown
Collaborator Author

The validation selector was updated to target only the actual technical name fields (name, customName, custom_name) so that optional displayName fields are no longer validated as required.

@crivetimihai crivetimihai self-assigned this Mar 7, 2026
Nayana-R-Gowda and others added 2 commits March 10, 2026 11:04
…form

The name-field validation selector used a wildcard (input[name*="name"])
that also matched displayName and display_name inputs, making the
optional display-name field effectively required.

Switch to explicit selectors for technical name fields only, and filter
out hidden inputs so edit-form hidden name fields are also skipped.

Closes #3433

Signed-off-by: NAYANA.R <nayana.r7813@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Cover the name-field selection logic introduced in the previous commit:
- visible name and customName inputs are validated on blur
- displayName and display_name inputs are excluded
- hidden name inputs (edit forms) are excluded
- error styling is applied/cleared correctly
- combined form scenarios (create + edit layouts)

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai force-pushed the bug/ui-tool-creation-requires-display-name branch from 47dd363 to 92f9c9a Compare March 10, 2026 11:10
Copy link
Copy Markdown
Member

@crivetimihai crivetimihai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified — the fix is correct and well-targeted.

Code review notes:

  • The old wildcard selector input[name*="name"] matched displayName and display_name fields, making the optional display name effectively required. The new explicit selectors (input[name="name"], input[name="customName"], input[name="custom_name"]) correctly target only technical name fields.
  • The hidden-input filter correctly excludes the name="name" hidden field in edit forms.
  • No security concerns — backend validate_display_name() validators in schemas.py still sanitize display names server-side.
  • No performance concerns.

Changes made during review:

  • Rebased onto main and squashed 5 commits (2 feature + 3 merge) into 1 clean commit, preserving original author.
  • Added 9 unit tests in tests/js/admin-form-validation.test.js covering all branches: visible name validated, customName validated, displayName excluded, display_name excluded, hidden name excluded, error styling applied/cleared, and combined create/edit form scenarios.
  • Verified E2E via Playwright: tool creation succeeds with empty display name, tool appears in the table.

All 831 JS tests pass.

@crivetimihai
Copy link
Copy Markdown
Member

Maintainer review changes

Rebased onto main, squashed 5 commits into 1 clean commit (preserving original author), and added differential test coverage:

Commits after rebase

  1. fix(ui): exclude display name from required-field validation in tool form — original fix by @Nayana-R-Gowda
  2. test(ui): add setupFormValidation tests for display name exclusion — 9 unit tests covering all selector/filter branches

Tests added (tests/js/admin-form-validation.test.js)

Test Validates
visible input[name="name"] validated on blur
input[name="customName"] validated on blur
input[name="displayName"] excluded from validation
input[name="display_name"] excluded from validation
hidden input[name="name"] excluded from validation
valid name clears styling error classes removed
invalid name shows styling border-red-500 applied
combined name + displayName form only name validated
edit form layout hidden name excluded, customName validated, displayName excluded

E2E verification

Verified via Playwright: created a tool with Display Name left empty — form submitted successfully, tool appeared in the table.

@crivetimihai crivetimihai merged commit 3c970d5 into main Mar 10, 2026
44 checks passed
@crivetimihai crivetimihai deleted the bug/ui-tool-creation-requires-display-name branch March 10, 2026 11:12
mitica pushed a commit to mitica/mcp-context-forge that referenced this pull request Mar 10, 2026
…form (IBM#3464)

* fix(ui): exclude display name from required-field validation in tool form

The name-field validation selector used a wildcard (input[name*="name"])
that also matched displayName and display_name inputs, making the
optional display-name field effectively required.

Switch to explicit selectors for technical name fields only, and filter
out hidden inputs so edit-form hidden name fields are also skipped.

Closes IBM#3433

Signed-off-by: NAYANA.R <nayana.r7813@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* test(ui): add setupFormValidation tests for display name exclusion

Cover the name-field selection logic introduced in the previous commit:
- visible name and customName inputs are validated on blur
- displayName and display_name inputs are excluded
- hidden name inputs (edit forms) are excluded
- error styling is applied/cleared correctly
- combined form scenarios (create + edit layouts)

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: NAYANA.R <nayana.r7813@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Dumitru C <canteadumitru@gmail.com>
MohanLaksh pushed a commit that referenced this pull request Mar 12, 2026
…form (#3464)

* fix(ui): exclude display name from required-field validation in tool form

The name-field validation selector used a wildcard (input[name*="name"])
that also matched displayName and display_name inputs, making the
optional display-name field effectively required.

Switch to explicit selectors for technical name fields only, and filter
out hidden inputs so edit-form hidden name fields are also skipped.

Closes #3433

Signed-off-by: NAYANA.R <nayana.r7813@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* test(ui): add setupFormValidation tests for display name exclusion

Cover the name-field selection logic introduced in the previous commit:
- visible name and customName inputs are validated on blur
- displayName and display_name inputs are excluded
- hidden name inputs (edit forms) are excluded
- error styling is applied/cleared correctly
- combined form scenarios (create + edit layouts)

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: NAYANA.R <nayana.r7813@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Yosiefeyob pushed a commit that referenced this pull request Mar 13, 2026
…form (#3464)

* fix(ui): exclude display name from required-field validation in tool form

The name-field validation selector used a wildcard (input[name*="name"])
that also matched displayName and display_name inputs, making the
optional display-name field effectively required.

Switch to explicit selectors for technical name fields only, and filter
out hidden inputs so edit-form hidden name fields are also skipped.

Closes #3433

Signed-off-by: NAYANA.R <nayana.r7813@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* test(ui): add setupFormValidation tests for display name exclusion

Cover the name-field selection logic introduced in the previous commit:
- visible name and customName inputs are validated on blur
- displayName and display_name inputs are excluded
- hidden name inputs (edit forms) are excluded
- error styling is applied/cleared correctly
- combined form scenarios (create + edit layouts)

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: NAYANA.R <nayana.r7813@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Yosief Eyob <yosiefogbazion@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working SHOULD P2: Important but not vital; high-value items that are not crucial for the immediate release ui User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][UI]: Unable to create a tool without a display name

3 participants